EasyCoding.uz

Courses / C++ Learning / Data Types

C++ Data Types

Mark as Complete

Pick the right type for speed, memory, and clarity.

Common Types

  • int for whole numbers
  • double for decimals
  • char for a single character
  • bool for true/false
  • std::string for text
Key takeaway: choose the smallest type that fits.

Example

#include <string>

int score = 95;
double pi = 3.14;
char letter = 'B';
bool is_ready = true;
std::string name = "Ali";

Ready to try it yourself?

Define a few variables with different types.

← Variables Functions →